package org.redtroy.theater.controller;

import org.redtroy.theater.service.IActivityService;
import org.redtroy.theater.service.dto.ActivityDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/")
public class TheaterController {
	@Autowired
	@Qualifier("activityService")
	private IActivityService activityService;

	@RequestMapping("/create")
	public @ResponseBody
	String createAcitivity(ActivityDTO activity) {
		try {
			activityService.createActivity(activity);
			return "success";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "fail";
	}

	@RequestMapping("/")
	public String showActivities() {
		return null;
	}

	@RequestMapping("/show")
	public String showPagedActivities() {
		return null;
	}

	public void setActivityService(IActivityService activityService) {
		this.activityService = activityService;
	}
}
